package com.gy.api.pc.movie.controller;

import com.github.pagehelper.PageInfo;
import com.gy.api.base.ApiIndex;
import com.gy.api.base.IDsEntity;
import com.gy.api.base.R;
import com.gy.api.base.RestPage;
import com.gy.api.pc.filings.domain.vo.WcContentExamineListVO;
import com.gy.api.pc.movie.domain.vo.*;
import com.gy.api.pc.movie.service.IFilmPermitInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api( tags = ApiIndex.FilmPermitInfoController)
@RestController
@RequestMapping("/system/permitInfo")
public class FilmPermitInfoController{
    @Autowired
    private IFilmPermitInfoService filmPermitInfoService;

    @ApiOperation("查询公映许可证信息列表")
    @GetMapping("/list")
    @ResponseBody
    public R<RestPage<FilmPermitInfoVO>> acceptanceList(@ApiParam(value = "查询参数") @ModelAttribute FilmPermitInfoSearchVO searchVO)  {
        List<FilmPermitInfoVO> list = filmPermitInfoService.getList(searchVO);
        RestPage restPage = new RestPage( new PageInfo(list),list);
        return new R(restPage);
    }

    @ApiOperation("新增公映许可证信息")
    @PostMapping("/add")
    @ResponseBody
    public R add(@RequestBody FilmPermitInfoAddVO filmPermitInfo){
        filmPermitInfoService.insertFilmPermitInfo(filmPermitInfo);
        return new R();
    }

    @ApiOperation("修改公映许可证信息")
    @PostMapping("/update")
    @ResponseBody
    public R edit(@RequestBody FilmPermitInfoUpdateVO updateVO)
    {
        filmPermitInfoService.updateFilmPermitInfo(updateVO);
        return new R();
    }

    @ApiOperation("删除公映许可证信息")
	@PostMapping("/remove")
    @ResponseBody
    public  R remove(@RequestBody IDsEntity iDsEntity)
    {
        filmPermitInfoService.deleteFilmPermitInfoByIds(iDsEntity.getIds());
        return new R();
    }
}
